// ... existing code ...
package com.example.xinai.Entity;

public class AjaxResult {
    private int code;
    private String message;
    private Object data;

    // 成功时的响应
    public static AjaxResult success() {
        return new AjaxResult(200, "操作成功", null);
    }

    // 成功时的响应，带数据
    public static AjaxResult success(Object data) {
        return new AjaxResult(200, "success", data);
    }

    // 失败时的响应
    public static AjaxResult error(int code, String message) {
        return new AjaxResult(code, message, null);
    }

    public static AjaxResult error(String message) {
        return new AjaxResult( message);
    }
    // 私有构造方法
    public AjaxResult(int code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }
    public AjaxResult(String message) {

        this.message = message;

    }

    // Getter和Setter方法
    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
